/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package EA_Model.IEC61970.Core.impl;

import EA_Model.IEC61970.Core.CorePackage;
import EA_Model.IEC61970.Core.IrregularTimePoint;

import EA_Model.IEC61970.Domain.Seconds;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Irregular Time Point</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link EA_Model.IEC61970.Core.impl.IrregularTimePointImpl#getTime <em>Time</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Core.impl.IrregularTimePointImpl#getValue1 <em>Value1</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Core.impl.IrregularTimePointImpl#getValue2 <em>Value2</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class IrregularTimePointImpl extends EObjectImpl implements IrregularTimePoint {
	/**
	 * The cached value of the '{@link #getTime() <em>Time</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTime()
	 * @generated
	 * @ordered
	 */
	protected Seconds time;

	/**
	 * The cached value of the '{@link #getValue1() <em>Value1</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getValue1()
	 * @generated
	 * @ordered
	 */
	protected EA_Model.IEC61970.Domain.Float value1;

	/**
	 * The cached value of the '{@link #getValue2() <em>Value2</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getValue2()
	 * @generated
	 * @ordered
	 */
	protected EA_Model.IEC61970.Domain.Float value2;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected IrregularTimePointImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return CorePackage.Literals.IRREGULAR_TIME_POINT;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Seconds getTime() {
		if (time != null && time.eIsProxy()) {
			InternalEObject oldTime = (InternalEObject)time;
			time = (Seconds)eResolveProxy(oldTime);
			if (time != oldTime) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, CorePackage.IRREGULAR_TIME_POINT__TIME, oldTime, time));
			}
		}
		return time;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Seconds basicGetTime() {
		return time;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setTime(Seconds newTime) {
		Seconds oldTime = time;
		time = newTime;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CorePackage.IRREGULAR_TIME_POINT__TIME, oldTime, time));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Float getValue1() {
		if (value1 != null && value1.eIsProxy()) {
			InternalEObject oldValue1 = (InternalEObject)value1;
			value1 = (EA_Model.IEC61970.Domain.Float)eResolveProxy(oldValue1);
			if (value1 != oldValue1) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, CorePackage.IRREGULAR_TIME_POINT__VALUE1, oldValue1, value1));
			}
		}
		return value1;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Float basicGetValue1() {
		return value1;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setValue1(EA_Model.IEC61970.Domain.Float newValue1) {
		EA_Model.IEC61970.Domain.Float oldValue1 = value1;
		value1 = newValue1;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CorePackage.IRREGULAR_TIME_POINT__VALUE1, oldValue1, value1));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Float getValue2() {
		if (value2 != null && value2.eIsProxy()) {
			InternalEObject oldValue2 = (InternalEObject)value2;
			value2 = (EA_Model.IEC61970.Domain.Float)eResolveProxy(oldValue2);
			if (value2 != oldValue2) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, CorePackage.IRREGULAR_TIME_POINT__VALUE2, oldValue2, value2));
			}
		}
		return value2;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Float basicGetValue2() {
		return value2;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setValue2(EA_Model.IEC61970.Domain.Float newValue2) {
		EA_Model.IEC61970.Domain.Float oldValue2 = value2;
		value2 = newValue2;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CorePackage.IRREGULAR_TIME_POINT__VALUE2, oldValue2, value2));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case CorePackage.IRREGULAR_TIME_POINT__TIME:
				if (resolve) return getTime();
				return basicGetTime();
			case CorePackage.IRREGULAR_TIME_POINT__VALUE1:
				if (resolve) return getValue1();
				return basicGetValue1();
			case CorePackage.IRREGULAR_TIME_POINT__VALUE2:
				if (resolve) return getValue2();
				return basicGetValue2();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case CorePackage.IRREGULAR_TIME_POINT__TIME:
				setTime((Seconds)newValue);
				return;
			case CorePackage.IRREGULAR_TIME_POINT__VALUE1:
				setValue1((EA_Model.IEC61970.Domain.Float)newValue);
				return;
			case CorePackage.IRREGULAR_TIME_POINT__VALUE2:
				setValue2((EA_Model.IEC61970.Domain.Float)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case CorePackage.IRREGULAR_TIME_POINT__TIME:
				setTime((Seconds)null);
				return;
			case CorePackage.IRREGULAR_TIME_POINT__VALUE1:
				setValue1((EA_Model.IEC61970.Domain.Float)null);
				return;
			case CorePackage.IRREGULAR_TIME_POINT__VALUE2:
				setValue2((EA_Model.IEC61970.Domain.Float)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case CorePackage.IRREGULAR_TIME_POINT__TIME:
				return time != null;
			case CorePackage.IRREGULAR_TIME_POINT__VALUE1:
				return value1 != null;
			case CorePackage.IRREGULAR_TIME_POINT__VALUE2:
				return value2 != null;
		}
		return super.eIsSet(featureID);
	}

} //IrregularTimePointImpl
